import axios from 'axios'
axios.defaults.baseURL = ''
let axiosPromise = {
  get: function (url, params) {
    return new Promise((resolve, reject) => {
      axios.get(url, {
        params: params
      })
        .then((response) => {
          if (response.data.code === '200') {
            resolve(response.data)
            console.log(11111)
          }
        })
        .catch((error) => {
          reject(error)
        })
    })
  },
  post: function (url, params) {
    return new Promise((resolve, reject) => {
      axios.post(url, {
        params: params
      })
        .then((response) => {
          resolve(response.data)
        })
        .catch((error) => {
          reject(error)
        })
    })
  }
}
export default axiosPromise
